//
//  DZWebViewController.m
//  DaZhePrivateHomeCuisineClient
//
//  Created by zouzhisheng on 15/2/6.
//  Copyright (c) 2015年 zouzhisheng. All rights reserved.
//

#import "DZWebViewController.h"

@interface DZWebViewController ()

@end

@implementation DZWebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [SharedAppDelegate.home.tabBarController setTabBarHidden:YES];
    [self loadWebView];
    
    // Do any additional setup after loading the view.
}
-(void)loadWebView{
    _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,self.navView.bottom,SCREEN_WIDTH,SYSTEM_VERSION>=7.0?SCREEN_HEIGHT-49:SCREEN_HEIGHT-20-49)]; // 初始化浏览器控件UIWebView
    _webView.delegate=self;
    NSString *str;
    if (self.fromHome) {
        str=self.alterItemModel.item_url;
        [self addTitle:self.alterItemModel.itemtitle];
    }else{
        str=self.adviceInfoSubModel.content;
        [self addTitle:self.adviceInfoSubModel.title];
    }
    NSLog(@"%@",str);
    [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
    [self.view addSubview:_webView];
    [self addTitle:self.adviceInfoSubModel.title];
  }
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)backAction:(UIButton*)bt{
    [self.navigationController popViewControllerAnimated:YES];
}
#pragma mark-UIWebViewDelegate
- (void)webViewDidStartLoad:(UIWebView *)webView{
    [self show:@"加载中..." DetailText:nil];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView{
    [self hideHud];
}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{
     [self hideHud];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
